import request from '@/utils/request.js'

/**
 *获取审批模板列表
 * @param {*} page
 * @param {*} pageSize
 * @param {*} oaProcessType
 * @returns
 */
export function list(page, pageSize, oaProcessTemplate) {
  return request({
    url: '/oaProcessTemplate/list',
    method: 'post',
    params: {
      page,
      pageSize
    },
    data: oaProcessTemplate
  })
}
/**
 * 保存审批模板
 * @param {*} oaProcessTemplate
 * @returns
 */
export function save(oaProcessTemplate) {
  return request({
    url: '/oaProcessTemplate/save',
    method: 'post',
    data: oaProcessTemplate
  })
}

/**
 * 发布部署流程
 * @param {*} id
 * @returns
 */
export function deploymentProcess(id) {
  return request({
    url: '/oaProcessTemplate/deploymentProcess',
    method: 'get',
    params: { id }
  })
}

/**
 * 删除审批模板
 * @param {*} id
 * @returns
 */
export function deleteById(id) {
  return request({
    url: `/oaProcessTemplate/deleteById/${id}`,
    method: 'delete'
  })
}

/**
 * 根据流程定义key获取表单信息
 * @param {*} processDefinitionKey
 * @returns
 */
export function processDefinitionKey(processDefinitionKey) {
  return request({
    url: '/oaProcessTemplate/processDefinitionKey',
    method: 'get',
    params: { processDefinitionKey }
  })
}
